<%--
  Created by IntelliJ IDEA.
  User: Smile
  Date: 2019/2/20
  Time: 15:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<html>
<head>
    <base href="<%=basePath%>">
    <title>试题练习</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <link href="resources/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <%--<link href="resources/bootstrap/css/bootstrap-huan.css" rel="stylesheet">--%>
    <link rel="stylesheet" href="resources/css/mobile-css/home.css" />

    <!-- Le styles -->
    <link href="resources/css/mobile-css/bootstrap.css" rel="stylesheet">
    <style type="text/css">
        body {
            padding-top: 60px;
            padding-bottom: 40px;
        }
        td{font-size:90%;}
    </style>
    <link href="resources/css/mobile-css/bootstrap-responsive.css" rel="stylesheet">
    <link rel="shortcut icon" href="<%=basePath%>resources/images/favicon.ico"/>
</head>
<body>
    <jsp:include page="mobile-header.jsp"/>
    <div class="container">
        <ul>
            <ul class="nav nav-pills">
                <c:forEach items="${fieldList }" var="item">
                    <li role="presentation" <c:if test="${item.fieldId == fieldId }"> class="active"</c:if>><a href="student/mobile/mobile-practice-list?fieldId=${item.fieldId }">${item.fieldName }</a></li>
                </c:forEach>
            </ul>

        </ul>
        <div class="row">
            <div class="span6">
                <div style="border-bottom: 1px solid #ddd;">
                    <h3 class="title">
                        <i class="fa fa-cloud-upload"></i> 强化练习
                    </h3>
                    <p>自主选择具体考点，各个击破</p>
                </div>
                <div class="question-list">

                    <c:forEach items="${kparl}" var="item">

                        <table class="table-striped table">
                            <thead>
                            <tr>
                                <td colspan="4"><h5>${item.knowledgePointName }</h5>
                                    <span style="color: #428bca;">学习进度：<fmt:formatNumber
                                            value="${item.finishRate }" type="percent" /></span></td>
                            </tr>
                            <tr>
                                <td>题型</td>
                                <td>可做总题目</td>
                                <td>已做题目</td>
                                    <%--<td>有异议题目</td>--%>
                                <td></td>
                            </tr>
                            </thead>
                            <tbody>
                            <c:forEach items="${item.typeAnalysis }" var="tp">
                                <tr>
                                    <td>${tp.questionTypeName }</td>
                                    <td><span class="span-info question-number">
                                            ${tp.restAmount + tp.rightAmount + tp.wrongAmount }
                                    </span></td>
                                    <td><span class="span-success question-number-2">${tp.rightAmount + tp.wrongAmount }</span></td>
                                        <%--<td><span class="span-success question-number-3">${tp.signAmount}</span></td>--%>
                                    <td><a href="student/mobile/mobile-practice-improve/${fieldId }/${item.knowledgePointId }/${tp.questionTypeId }"
                                           class="btn btn-success btn-sm join-practice-btn">参加练习</a></td>
                                </tr>
                            </c:forEach>
                            </tbody>
                            <tfoot></tfoot>
                        </table>
                    </c:forEach>

                </div>
            </div>
            <div class="span6">
                <div style="border-bottom: 1px solid #ddd;">
                    <h3 class="title">
                        <i class="fa fa-eraser"></i> 错题练习
                    </h3>
                    <p>收录做过的所有错题</p>
                </div>
                <div class="question-list">

                    <table class="table-striped table">
                        <thead>

                        <tr>
                            <td>知识分类</td>
                            <td>题目数量</td>
                            <td></td>
                            <td></td>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${historyMap }" var="item">
                            <c:if test="${item.value.wrongAmount != '0'}">
                                <tr>
                                    <td>${pointMap[item.key].pointName }</td>
                                    <td><span class="span-info question-number">${item.value.wrongAmount }</span></td>
                                    <td><a href="student/mobile/mobile-practice-incorrect/${item.value.fieldId }/${item.value.pointId }"
                                           class="btn btn-success btn-sm join-practice-btn">参加练习</a></td>
                                </tr>
                            </c:if>
                        </c:forEach>

                        </tbody>
                        <tfoot></tfoot>
                    </table>

                </div>


            </div>
            <div class="span6">
                <div style="border-bottom: 1px solid #ddd; margin-bottom: 20px;">
                    <h3 class="title">
                        <i class="fa fa-superscript"></i> 随机练习
                    </h3>
                    <p>从题库中随机取出试题练习</p>

                </div>
                <a class="btn btn-success " href="student/mobile/mobile-practice-test/${fieldId}">随机来20道 </i>
                </a>
            </div>
        </div>
        <hr>
        <jsp:include page="footer.jsp"/>
    </div>
    <script type="text/javascript" src="resources/js/jquery/jquery-1.9.0.min.js"></script>
    <script type="text/javascript" src="resources/bootstrap/js/bootstrap.min.js"></script>
    <script>
        $(function() {
            bindQuestionKnowledage();
            var result = checkBrowser();
            if (!result) {
                alert("请至少更新浏览器版本至IE8或以上版本");
            }
        });

        function checkBrowser() {
            var browser = navigator.appName;
            var b_version = navigator.appVersion;
            var version = b_version.split(";");
            var trim_Version = version[1].replace(/[ ]/g, "");
            if (browser == "Microsoft Internet Explorer"
                && trim_Version == "MSIE7.0") {
                return false;
            } else if (browser == "Microsoft Internet Explorer"
                && trim_Version == "MSIE6.0") {
                return false;
            } else
                return true;
        }

        function bindQuestionKnowledage() {
            $(".knowledge-title").click(function() {
                var ul = $(this).parent().find(".question-list-knowledge");

                if (ul.is(":visible")) {
                    $(this).find(".fa-chevron-down").hide();
                    $(this).find(".fa-chevron-up").show();

                    $(".question-list-knowledge").slideUp();

                } else {
                    $(".fa-chevron-down").hide();
                    $(".fa-chevron-up").show();

                    $(this).find(".fa-chevron-up").hide();
                    $(this).find(".fa-chevron-down").show();

                    $(".question-list-knowledge").slideUp();
                    ul.slideDown();

                }

            });
        }
    </script>
</body>
</html>
